package org.rjxh.examfront.pojo;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class CodeRespond {
    private int returnCode;
    private String stdout;
    private String stderr;
    // 添加一个带有String参数的构造函数
    public CodeRespond(String json) {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            CodeRespond codeRespond = objectMapper.readValue(json, CodeRespond.class);
            this.returnCode = codeRespond.getReturnCode();
            this.stdout = codeRespond.getStdout();
            this.stderr = codeRespond.getStderr();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
